package com.young.eventcoach.board;

import java.util.ArrayList;

import android.content.Context;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.young.eventcoach.R;

public class BoardPostingListAdapter extends ArrayAdapter<BoardListItem>{
	Context context;
	ArrayList<BoardListItem> arr_board_list_item;
	int resId;

	public BoardPostingListAdapter(Context context, int textViewResourceId, ArrayList<BoardListItem> arr_board_list_item) {
		super(context, textViewResourceId, arr_board_list_item);
		this.context = context;
		this.arr_board_list_item = arr_board_list_item;
		this.resId = textViewResourceId;
	}
	
	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		View view = convertView;
		if(view == null){
			view = View.inflate(context, resId, null);
		}
		ImageView iv_board_list_image = (ImageView)view.findViewById(R.id.iv_board_list_image);
		TextView tv_board_list_title = (TextView)view.findViewById(R.id.tv_board_list_title);
		TextView tv_board_list_reply = (TextView)view.findViewById(R.id.tv_board_list_reply);
		TextView tv_board_list_posting_day = (TextView)view.findViewById(R.id.tv_board_list_posting_day);
		
		tv_board_list_title.setText(arr_board_list_item.get(position).getTitle());
		return view;
	}

}
